package com.co.server.entity.vote;

import java.util.Date;

import org.springframework.format.annotation.DateTimeFormat;

import com.co.common.utils.StringUtil;
import com.co.server.entity.vote.aide.TVoteConstent;

public class TVote {
    /** id */
    private Integer id;

    /** 标题 */
    private String title;

    /** 描述 */
    private String desc;

    /** 分类Id */
    private Integer classId;

    /** 分类名称 */
    private String className;

    /** 总投票数 */
    private Integer voteNum;

    /** 赞数量 */
    private Integer supportNum;

    /** 踩数量 */
    private Integer objectNum;

    /** 1:单选框；0复选框 */
    private Byte isRadio;

    /** 0：未死亡；1已死亡 */
    private Byte dead;
    
    {
    	setDead(TVoteConstent.VOTE_NOT_DEAD);
    }

    /** 创建时间 */
    @DateTimeFormat(pattern="yyyy-MM-dd HH-mm-ss")
    private Date createTime;

    /** 创建者Id */
    private Integer createUserId;

    /** 1：有效；0：无效 */
    private Byte status;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = StringUtil.xxlParse(title);
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = StringUtil.xxlParse(desc);
    }

    public Integer getClassId() {
        return classId;
    }

    public void setClassId(Integer classId) {
        this.classId = classId;
    }

    public String getClassName() {
        return className;
    }

    public void setClassName(String className) {
        this.className = className == null ? null : className.trim();
    }

    public Integer getVoteNum() {
        return voteNum;
    }

    public void setVoteNum(Integer voteNum) {
        this.voteNum = voteNum;
    }

    public Integer getSupportNum() {
        return supportNum;
    }

    public void setSupportNum(Integer supportNum) {
        this.supportNum = supportNum;
    }

    public Integer getObjectNum() {
        return objectNum;
    }

    public void setObjectNum(Integer objectNum) {
        this.objectNum = objectNum;
    }

    public Byte getIsRadio() {
        return isRadio;
    }

    public void setIsRadio(Byte isRadio) {
        this.isRadio = isRadio;
    }

    public Byte getDead() {
        return dead;
    }

    public void setDead(Byte dead) {
        this.dead = dead;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Integer getCreateUserId() {
        return createUserId;
    }

    public void setCreateUserId(Integer createUserId) {
        this.createUserId = createUserId;
    }

    public Byte getStatus() {
        return status;
    }

    public void setStatus(Byte status) {
        this.status = status;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        TVote other = (TVote) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getTitle() == null ? other.getTitle() == null : this.getTitle().equals(other.getTitle()))
            && (this.getDesc() == null ? other.getDesc() == null : this.getDesc().equals(other.getDesc()))
            && (this.getClassId() == null ? other.getClassId() == null : this.getClassId().equals(other.getClassId()))
            && (this.getClassName() == null ? other.getClassName() == null : this.getClassName().equals(other.getClassName()))
            && (this.getVoteNum() == null ? other.getVoteNum() == null : this.getVoteNum().equals(other.getVoteNum()))
            && (this.getSupportNum() == null ? other.getSupportNum() == null : this.getSupportNum().equals(other.getSupportNum()))
            && (this.getObjectNum() == null ? other.getObjectNum() == null : this.getObjectNum().equals(other.getObjectNum()))
            && (this.getIsRadio() == null ? other.getIsRadio() == null : this.getIsRadio().equals(other.getIsRadio()))
            && (this.getDead() == null ? other.getDead() == null : this.getDead().equals(other.getDead()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getCreateUserId() == null ? other.getCreateUserId() == null : this.getCreateUserId().equals(other.getCreateUserId()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getTitle() == null) ? 0 : getTitle().hashCode());
        result = prime * result + ((getDesc() == null) ? 0 : getDesc().hashCode());
        result = prime * result + ((getClassId() == null) ? 0 : getClassId().hashCode());
        result = prime * result + ((getClassName() == null) ? 0 : getClassName().hashCode());
        result = prime * result + ((getVoteNum() == null) ? 0 : getVoteNum().hashCode());
        result = prime * result + ((getSupportNum() == null) ? 0 : getSupportNum().hashCode());
        result = prime * result + ((getObjectNum() == null) ? 0 : getObjectNum().hashCode());
        result = prime * result + ((getIsRadio() == null) ? 0 : getIsRadio().hashCode());
        result = prime * result + ((getDead() == null) ? 0 : getDead().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getCreateUserId() == null) ? 0 : getCreateUserId().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", title=").append(title);
        sb.append(", desc=").append(desc);
        sb.append(", classId=").append(classId);
        sb.append(", className=").append(className);
        sb.append(", voteNum=").append(voteNum);
        sb.append(", supportNum=").append(supportNum);
        sb.append(", objectNum=").append(objectNum);
        sb.append(", isRadio=").append(isRadio);
        sb.append(", dead=").append(dead);
        sb.append(", createTime=").append(createTime);
        sb.append(", createUserId=").append(createUserId);
        sb.append(", status=").append(status);
        sb.append("]");
        return sb.toString();
    }
}